package Service;

import Data.event;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

public class GetMassage {
    private static Socket socket;

    public synchronized static Socket getSocket() {
        return socket;
    }

    public synchronized static void setSocket(Socket socket) {
        GetMassage.socket = socket;
    }

    public synchronized event getMassage() throws IOException, ClassNotFoundException {
        ObjectInputStream reader=new ObjectInputStream(socket.getInputStream());
        event returnmassage=(event) reader.readObject();
        return returnmassage;
    }

    public GetMassage() {
    }
}
